package ins.wink.service.impl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import ins.wink.entity.Userinfo;
import ins.wink.mapper.UserInfoMapper;
import ins.wink.service.UserInfoService;
/**
 * 用户service接口实现层
 */
@Service
@Transactional
public class UserInfoServiceImpl implements UserInfoService {
	//注入用户mapper层
	@Autowired
	private UserInfoMapper userInfoMapper;
	//登录
	@Override
	public Userinfo logins(Userinfo user) {
		//方法
		Userinfo userinfo = userInfoMapper.login(user);
		//判断
		if(userinfo!=null){
			return userinfo;
		}else {
			return null;
		}
	}
	/**
	 * 注册
	 */
	@Override
	public int insertUsers(Userinfo user) {
		int i = userInfoMapper.insertUser(user);
		if(i!=0) {
			return i;
		}else {
			return 0;
		}
	}
}
